﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace System
{
    public static  class JsonExtent
    {
        /// <summary>
        /// 序列化对象
        /// </summary>
        /// <param name="obj">需要被序列化的对象</param>
        /// <returns></returns>
        public static String Serialize(this Object obj)
        {
            return System.Json.Convert.SerializeObject(obj);
        }

        /// <summary>
        /// 反序列化字符串
        /// </summary>
        /// <param name="json">需要被反序列化的Json字符串</param>
        /// <param name="t">反系列化的目标对象的type</param>
        /// <returns></returns>
        public static Object Deserialize(this String json, Type t)
        {
            return System.Json.Convert.DeserializeObject(json, t);
        }
    }
}
